<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>vue的双向数据绑定</title>
</head>

<body>
  <div id="app">
    <h2>{{title}}</h2>
    <input v-model="name">
    <h1>{{name}}</h1>
    <button v-on:click="clickMe">click me!</button>
  </div>

  <script src="./observer.js"></script>
  <script src="./watcher.js"></script>
  <script src="./compile.js"></script>
  <script src="./index.js"></script>
  <script>

    new MyVue({
      el: '#app',
      data: {
        title: 'hello world',
        name: '大家好！'
      },
      methods: {
        clickMe: function () {
          this.name = '新年好！'
        }
      },
      mounted() {
        window.setTimeout(() => {
          this.title = '你好！';
        }, 2000);
      },
    })


  </script>
</body>

</html>